<%@ include file="/common/taglibs.jsp"%>
<%@ page language="java" pageEncoding="UTF-8"%>
  <%@ include file="/common/extjs.jsp"%>
<script type="text/javascript" >

 /** 
 * 附件管理窗口
 */
 function showUploadWin(no)  {
	    
	 var projectid ='${(empty param.projectId) ?(projectInfo.projectId):(param.projectId)}';
  	 var fid ='${param.fid}';
        if(no ==1){
           var tableName = "labsRegistrationForm ";
           var tableField = [['labsRegistrationForm','《广东省公路水运工程项目工地试验室备案登记表》']
  					 ];
         projectAttachment.init(projectid,fid,tableName,tableField);
         projectAttachment.showUploadJquery("《广东省公路水运工程项目工地试验室备案登记表》");
        }else if(no ==2){
        	var tableName = "labsAuthorizationForm";
            var tableField = [['labsAuthorizationForm','《公路水运工程工地试验室设立授权书》']
    					 ];
           projectAttachment.init(projectid,fid,tableName,tableField);
           projectAttachment.showUploadJquery("《公路水运工程工地试验室设立授权书》 ");
          }else if(no ==3){
        	  var tableName = "labsDetectionInstitutions";
          var tableField = [['labsRatingCertificate','等级证书'],['labsMeasurementCertificate','计量认证证书'],['labsEntrustCopies','委托合同复印件 ']
  					 ];
         projectAttachment.init(projectid,fid,tableName,tableField);
         projectAttachment.showUploadJquery("母体检测机构《等级证书》及业务范围复印件");
        }else if(no ==4){
        	var tableName = "labsDetectPerson";
          var tableField = [['labsDetectPerson','试验检测人员']
  					 ];
         projectAttachment.init(projectid,fid,tableName,tableField);
         projectAttachment.showUploadJquery("试验检测人员学历、职称、检测证书及聘（任）用关系证明文件");
        }else if(no ==5){
        	var tableName = "labsEquipCalibrationCertificate";
          var tableField = [['labsEquipCalibrationCertificate','仪器设备检定证书复印件']
  					 ];
         projectAttachment.init(projectid,fid,tableName,tableField);
         projectAttachment.showUploadJquery("仪器设备检定证书复印件 ");
        }else if(no ==6){
        	var tableName = "labsWorkRegimeManage";
          var tableField = [['labsWorkRegimeManage','相关工作制度及管理制度']
  					 ];
         projectAttachment.init(projectid,fid,tableName,tableField);
         projectAttachment.showUploadJquery("相关工作制度及管理制度 ");
        }
   }  


 
Ext.onReady(function(){
  Ext.QuickTips.init();
  var myData = [
                ['1','1','《广东省公路水运工程项目工地试验室备案登记表》'],
                ['2','2','《公路水运工程工地试验室设立授权书》'],
                ['3','3','母体检测机构《等级证书》及业务范围复印件'],
                ['4','4','试验检测人员学历、职称、检测证书及聘（任）用关系证明文件'],
                ['5','5','仪器设备检定证书复印件'],
                ['6','6','相关工作制度及管理制度']
    ];
     // Record
    MplabsAffix = Ext.data.Record.create([
                                    {name: 'no', type: 'string'},
    								{name: 'kind', type: 'string'},
    								{name: 'file', type: 'string'},
    ]);
    
    // create the data store
    var store = new Ext.data.Store({
        reader: new Ext.data.ArrayReader(
        {
            idIndex: 0  // id for each record will be the first element
        },MplabsAffix)
    });
  store.loadData(myData);
  
  var cm = new Ext.grid.ColumnModel([
       {header: "序号", width: 45, dataIndex: 'no'},
       {header: "kind", width: 75, dataIndex: 'kind',hidden: true},
       {id:'file',header: "工地试验室的能力确认备案申请材料表", width: 360, dataIndex: 'file',renderer:Jinyi.project.Format.textAreaRenderer},
       {
					           header:  	'资料查询',
							   align: 'center',
								dataIndex : '',
					           renderer: function(value, metaData, record, rowIndex, colIndex, store) {
					            var no = record.get('no');
					          //  if(no == 2){
					            //    return; 
					           // }
					            var href = "<span class='upload_renderer'><a href='javascript:showUploadWin(\""+no+"\")' >查看资料</a></span>";
					            return href;
					           },  
					           width: 		180
     	 }
  
  ]);
  
  // create the Grid
  var grid = new Ext.grid.GridPanel({
      store: store,
      cm: cm,
      tbar:[{text:"批量下载",handler:function(){
      	 var projectid ='${(empty param.projectId) ?(projectInfo.projectId):(param.projectId)}';
      	 var fid ='${param.fid}';
     	location.href = "${ctx}/attachment/attachment!downloadMany.action?tableId="+fid+"&partId="+projectid;
     }}],
      sm:	new Ext.grid.RowSelectionModel({singleSelect:true}),
      frame:true,
		viewConfig: {
     		forceFit: false,
      	getRowClass: function(record, index) {
 			 }
 			},
      loadMask:true, 
      autoExpandColumn: 'file'
  });
  
  var viewport = new Ext.Viewport({
      layout:'fit',
      items:[grid]
      });
})
</script>
<body>
<div id="mplabsAffix"></div>
</body>



